﻿Imports System.Data.OleDb
Public Class RateDetails
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub comment_Click(ByVal sender As Object, ByVal e As EventArgs) Handles comment.Click
        Dim sql As String = "INSERT INTO feedback (username,feedback,comment,tips_fkid) values (@f1,@f2,@f3,@f4)"
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("skinConnectionstring").ConnectionString)
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)
        cmd.Parameters.AddWithValue("@f1", User.Identity.Name)
        cmd.Parameters.AddWithValue("@f2", f2.Text)
        cmd.Parameters.AddWithValue("@f3", f3.Text)
        cmd.Parameters.AddWithValue("@f4", Request.QueryString("ID"))
        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()
        Response.Redirect("RateDetails.aspx?ID=" & Request.QueryString("ID"))
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("skinConnectionstring").ConnectionString)
        conn.Open()
        Dim delprevRatings = "delete from ratings where rater=@f1 and tipsid=@f2"
        Dim cmd1 As OleDbCommand = New OleDbCommand(delprevRatings, conn)

        cmd1.Parameters.AddWithValue("@f1", User.Identity.Name)
        cmd1.Parameters.AddWithValue("@f3", Request.Params("ID"))
        cmd1.ExecuteNonQuery()
        Dim sql = "Insert into ratings (rating,rater,tipsid) values (@f1,@f2,@f3)"
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)

        cmd.Parameters.AddWithValue("@f1", Rating1.CurrentRating)
        cmd.Parameters.AddWithValue("@f2", User.Identity.Name)
        cmd.Parameters.AddWithValue("@f3", Request.Params("ID"))
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()



    End Sub
End Class




